import React from "react"

const highlight = (source, key, color) => {
  const _color = color || "#1890ff"
  return (
    <div dangerouslySetInnerHTML={{
      __html: source
        ? source.replace(key, `<span style=color:${_color};>${key}</span>`)
        : source
    }}/>
  )
}

export default highlight